<!DOCTYPE html>
<html lang="en">
<head>
<title>info</title>

<link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" />
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/common.css" rel="stylesheet" media="screen">
<link href="css/info.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="js/jquery.tmpl.js"></script>
<script>

$(function() {
	
$("#various1").fancybox({
	'titlePosition'		: 'inside',
	'transitionIn'		: 'none',
	'transitionOut'		: 'none'
});

$("#various1").click(function () {

	 });
$("#various4").fancybox({
	'titlePosition'		: 'inside',
	'transitionIn'		: 'none',
	'transitionOut'		: 'none'
});

$("#various4").click(function () {

	 });
$(".btn_newInfo").click(function () {
	$.fancybox.close();
	 });
$(".bar a").hover(
 function () {
    var c = $(this).attr("class");
	var s = c.substring(c.length-7,c.length);
	if(s!="onclick")
	$(this).attr("class",c+"_hover");
  },
  function () {
    var c = $(this).attr("class");
	var s = c.substring(c.length-7,c.length);
	if(s!="onclick")
	$(this).attr("class",c.substring(0,c.length-6));
  }
);


 
 
 
}); 

</script>
</head>
<body>
<div class="header">
	<a style=" float:left;" href="#"><img height="70" width="199" src="images/LOGO.png"></a>
    <span style="margin-left:500px;">欢迎！</span>
    <span>贺鹏飞</span>
    <span style="margin-left:20px;">权限：</span>
    <span>管理员</span>
    <button class="btn" style="float:right; margin-right:30px; margin-top:5px;" type="button">注销</button>
    <div class="clear"></div>
    <li class="bar"><a class="bar_info_onclick" href="#"></a></li>
    <li class="bar"><a class="bar_resource" href="#"></a></li>
    <li class="bar"><a class="bar_project" href="#"></a></li>
    <li class="bar"><a class="bar_team" href="#"></a></li>
    <li class="bar"><a class="bar_future" href="#"></a></li>
</div>
<div class="content"> 
	<div class="info">
    	<div class="infoHeader">
        	<span class="Headerfont">近期通知：</span>
			<li class="btn" style="float:right; margin-right:30px; margin-top:5px;"><a id="various1" href="#inline1">新公告</a></li>
        </div>
        <div id="information" class="infoContent"></div>
        <div class="infoPage">
        	    <div class="pagination" style="margin:0;">  
                    <ul>  
                        <li><a class="fenye" href="javascript:void(0)" onclick="firstPage1();">首页</a></li>  
                        <li><a class="fenye" href="javascript:void(0)" onclick="prePage1();">前一页</a></li>  
                 
                        <!-- 跳转 -->  
                        <li><a class="fenye"> 第 <input id="infor_page" type="text" maxlength="2" style="margin:2px;; width: 20px; height: 16px;">页 </a></li>  
                        <li><a class="fenye"  id="skip" href="javascript:void(0)" onclick="skipPage1();">转到</a></li>  
                  
                        <!-- 下一页按钮 -->  
                            <li><a class="fenye" href="javascript:void(0)" onclick="nextPage1();">下一页</a></li>  
                  
                        <!-- 分页尾页按钮 -->  
                            <li><a class="fenye" href="javascript:void(0)" onclick="lastPage1();">尾页</a></li>  
                    </ul>  
                </div>  
        </div>
    </div>
	<div class="message">
    	<div class="messageHeader">
        	<span class="Headerfont">信息：</span>
            <li class="btn" style="float:right; margin-right:30px; margin-top:5px;"><a id="various4" href="#inline4">新信息</a></li>
        </div>
        <div id="messages" class="messageContent"></div>
        <div class="messagPage">
             <div class="pagination" style="margin:0;">  
                <ul>  
                    <li><a class="fenye" href="javascript:void(0)" onclick="firstPage2();">首页</a></li>  
                    <li><a class="fenye" href="javascript:void(0)" onclick="prePage2();">前一页</a></li>  
             
                    <!-- 跳转 -->  
                    <li><a class="fenye"> 第 <input id="notice_page" type="text" maxlength="2" style="margin:2px;; width: 20px; height: 16px;">页 </a></li>  
                    <li><a class="fenye"  id="skip" href="javascript:void(0)" onclick="skipPage2();">转到</a></li>  
              
                    <!-- 下一页按钮 -->  
                    <li><a class="fenye" href="javascript:void(0)" onclick="nextPage2();">下一页</a></li>  
              
                    <!-- 分页尾页按钮 -->  
                    <li><a class="fenye" href="javascript:void(0)" onclick="lastPage2(0);">尾页</a></li>  
                </ul>  
            </div>  
        </div>
    </div>
</div>
<!--新公告弹窗-->
	<div style="display: none;">
		<div id="inline1" style="width:680px;height:400px;overflow:auto;">
    		 <div class="newInfoHeader"></div>
             <div class="newInfoTitle">
             <span>标题：</span><input id="newInfoTitle" /><button class="btn_newInfo"type="button" onClick="newInfo()">发布</button>
             </div>
            <textarea id="newInfoContent" style="width:666px; font-size:18px; max-height:280px;" rows="15"></textarea> 
		</div>
	</div>
<!--新信息弹窗-->
	<div style="display: none;">
		<div id="inline4" style="width:680px;height:400px;overflow:auto;">
    		 <div class="newInfoHeader"></div>
             <div class="newInfoTitle">
             <span>标题：</span><input id="newNoticeTitle" /><button class="btn_newInfo"type="button" onClick="newNotice()">发布</button>
             </div>
            <textarea id=newNoticeContent style="width:666px; font-size:18px; max-height:280px;" rows="15"></textarea> 
		</div>
	</div>
<!--详细内容弹窗-->
	<div style="display: none;">
		<div id="inline2" style="width:680px;height:400px;overflow:auto;">
    		 <div class="newInfoHeader"></div>
             <div class="newInfoTitle">
             <p id="inline2_title">标题2：</p>
             <p id="inline2_date">标题2：</p>
             <p id="inline2_data">标题2：</p>
             <p id="inline2_sender">标题2：</p>
             </div>
		</div>
	</div>

<div class="foot"></div>
<script id="infor_row" type="text/x-jquery-tmpl">
<div class="infoRow"><span class="infoRow_title"><a id="${id}" class="various2" href="#inline2">${title}</a></span><span class="infoRow_data">${data}</span></div>
</script>
<script id="message_row" type="text/x-jquery-tmpl">
<div class="infoRow"><span class="infoRow_title"><a id="${id}" class="various3" href="#inline2">${title}</a></span><span class="infoRow_data">${data}</span></div>
</script>
<script>
$("#infor_page").val(parseInt(1));   

var totlePage=1;
var nowpage=1;

function skipPage(page){   	
	if(page>=1&&page<=totlePage)
	{
		nowpage =page;
		$("#infor_page").val(nowpage);   
		$('#information').html("");
		$.ajax({
			   type: "POST",
			   url: "infoPage/get_info_page/"+nowpage,
			  // data: "page="+1,
			   success: function(msg){
				   var json = eval('(' + msg + ')'); 
				   totlePage = json.totlePage;
					for ( i in json.content){
					//alert(json.content[i].id);
					$('#infor_row').tmpl([{"id":json.content[i].id,"title":json.content[i].title,"data":json.content[i].data}]).appendTo('#information');
					}
					$(".various2").fancybox({
						'titlePosition'		: 'inside',
						'transitionIn'		: 'none',
						'transitionOut'		: 'none'
					});

					$(".various2").click(function () {
							var ID=this.id;
							$.ajax({
								 type: "POST",
								   url: "infoPage/get_info/"+ID,
								  // data: "page="+1,
								   success: function(msg){
									   var json = eval('(' + msg + ')'); 
									   $("#inline2_title").html(json.title);
									   $("#inline2_date").html(json.date);
									   $("#inline2_data").html(json.data);
									   $("#inline2_sender").html(json.sender);
								   }
							});
					});
			   }
		});

	}
};

$('#information').html("");
$.ajax({
	   type: "POST",
	   url: "infoPage/get_info_page/"+1,
	  // data: "page="+1,
	   success: function(msg){
		    var json = eval('(' + msg + ')');  
		    totlePage = json.totlePage;
			for ( i in json.content){
			$('#infor_row').tmpl([{"id":json.content[i].id,"title":json.content[i].title,"data":json.content[i].data}]).appendTo('#information');
			}
			
			$(".various2").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$(".various2").click(function () {
					var ID=this.id;
					$.ajax({
						 type: "POST",
						   url: "infoPage/get_info/"+ID,
						  // data: "page="+1,
						   success: function(msg){
							   var json = eval('(' + msg + ')'); 
							   $("#inline2_title").html(json.title);
							   $("#inline2_date").html(json.date);
							   $("#inline2_data").html(json.data);
							   $("#inline2_sender").html(json.sender);
						   }
					});
			});
	   }
});

function firstPage1(){   
	skipPage(1);

};
function skipPage1(){   
	skipPage(parseInt($("#infor_page").val().trim()));
};

function nextPage1(){   
if(nowpage<totlePage)
{
	var page = ++nowpage;
	skipPage(parseInt(page));
}

};
function prePage1(){   
	if(nowpage>1)
	{
		var page = --nowpage;
		skipPage(parseInt(page));
	}
};
function lastPage1(){   
	var page = totlePage;
	skipPage(parseInt(totlePage));
};
function newInfo(){   
	var title=$("#newInfoTitle").val();
	var content=$("#newInfoContent").val();
	$.ajax({
		   type: "POST",
		   url: "infoPage/test_new_info",
		   data:{ title: title, content: content},
		   success: function(msg){
				if(msg==1)
					alert("发布成功");
				else 
					alert("发布失败，请重试");
				
				skipPage(1);
		   }
	});
	
};


</script>   

<script>
$("#notice_page").val(parseInt(1));

var notice_totlePage=1;
var notice_nowpage=1;

function skipPage_notice(page){   	
	if(page>=1&&page<=notice_totlePage)
	{
		notice_nowpage =page;
		$("#notice_page").val(notice_nowpage);   
		$('#messages').html("");
		$.ajax({
			   type: "POST",
			   url: "infoPage/get_notice_page/"+notice_nowpage,
			  // data: "page="+1,
			   success: function(msg){
				   var json = eval('(' + msg + ')');  
				   notice_totlePage = json.totlePage;
					for ( i in json.content){
					//alert(json.content[i].id);
					$('#message_row').tmpl([{"id":json.content[i].id,"title":json.content[i].title,"data":json.content[i].data}]).appendTo('#messages');
					}
					$(".various3").fancybox({
						'titlePosition'		: 'inside',
						'transitionIn'		: 'none',
						'transitionOut'		: 'none'
					});

					$(".various3").click(function () {
							var ID=this.id;
							$.ajax({
								 type: "POST",
								   url: "infoPage/get_notice/"+ID,
								  // data: "page="+1,
								   success: function(msg){
									   var json = eval('(' + msg + ')'); 
									   $("#inline2_title").html(json.title);
									   $("#inline2_date").html(json.date);
									   $("#inline2_data").html(json.data);
									   $("#inline2_sender").html(json.sender);
								   }
							});
					});
			   }
		});

	}
};

$('#messages').html("");
$.ajax({
	   type: "POST",
	   url: "infoPage/get_notice_page/"+1,
	  // data: "page="+1,
	   success: function(msg){
		    var json = eval('(' + msg + ')');  
		    notice_totlePage = json.totlePage;
			for ( i in json.content){
			$('#message_row').tmpl([{"id":json.content[i].id,"title":json.content[i].title,"data":json.content[i].data}]).appendTo('#messages');
			}
			
			$(".various3").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$(".various3").click(function () {
					var ID=this.id;
					$.ajax({
						 type: "POST",
						   url: "infoPage/get_notice/"+ID,
						  // data: "page="+1,
						   success: function(msg){
							   var json = eval('(' + msg + ')'); 
							   $("#inline2_title").html(json.title);
							   $("#inline2_date").html(json.date);
							   $("#inline2_data").html(json.data);
							   $("#inline2_sender").html(json.sender);
						   }
					});
			});
	   }
});

function firstPage2(){   
	skipPage_notice(1);

};
function skipPage2(){   
	skipPage_notice(parseInt($("#notice_page").val().trim()));
};

function nextPage2(){   
if(notice_nowpage<notice_totlePage)
{
	var page = ++notice_nowpage;
	skipPage_notice(parseInt(page));
}

};
function prePage2(){   
	if(notice_nowpage>1)
	{
		var page = --notice_nowpage;
		skipPage_notice(parseInt(page));
	}
};
function lastPage2(){   
	var page = notice_totlePage;
	skipPage_notice(parseInt(page));
};
function newNotice(){   
	var title=$("#newNoticeTitle").val();
	var content=$("#newNoticeContent").val();
	$.ajax({
		   type: "POST",
		   url: "infoPage/test_new_notice",
		   data:{ title: title, content: content},
		   success: function(msg){
				if(msg=="1")
					alert("发布成功");
				else 
					alert("发布失败，请重试");
				
				skipPage_notice(1);
		   }
	});
	
};


</script>   
  </body>
</html>